<%@ page language="java" pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>
<%
			String keyword = request.getParameter("keyword") == null || request.getParameter("keyword").trim().equals("") ? "" : request
			.getParameter("keyword").trim();
	String filed = request.getParameter("field") == null || request.getParameter("field").trim().equals("") ? null : request.getParameter(
			"field").trim();
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<base href="<%=basePath%>" />
		<title>文章搜索</title>
		<script type="text/javascript" src="js/jquery-1.7.2.min.js"></script>
		<script type="text/javascript" src="search/search.js"></script>
	</head>
	<body>
		<div id="seachform">
			<div class="seaches">
				<div class="seachtxt">
					<input type="text" id="key" name="key" value="<%=keyword%>" />
				</div>
				<div class="seachbntdiv">
					<input type="button" class="seachbnt" value="" onclick="simpleSearch();">
				</div>
				<div style="clear: both;"></div>
			</div>
			<div class="seach2">
				<input type="radio" name="filed" value="title" <%=filed != null && filed.equals("title") ? "checked=\"checked\"" : ""%> />
				标题
				<input type="radio" name="filed" value="summary" <%=filed != null && filed.equals("summary") ? "checked=\"checked\"" : ""%> />
				文章摘要
				<input type="radio" name="filed" value="content" <%=filed != null && filed.equals("content") ? "checked=\"checked\"" : ""%> />
				文章内容
				<input type="radio" name="filed" value="all" <%=filed != null && filed.equals("all") ? "checked=\"checked\"" : filed == null ? "checked=\"checked\"" : ""%> />
				全文
			</div>
		</div>
		<div id="result" style="width: 100%; margin: 0 auto;text-align: center;">
			<!-- 搜索结果展现容器id必须为result -->
		</div>
	</body>
	<script type="text/javascript">
		/*设置搜索项*/
		var field = '${param.field}';
		var fields = $("input[type='radio']");
		if(field!=""&&!isNaN(field)){
			if(field>=0&&field<fields.length){
				fields[field].checked=true;
			}
		}
		/*设置关键字*/
		var keyword = '${param.keyword}';
		if(keyword!=''){
			$("#key").val(keyword);
			simpleSearch();
		}
		/*检测登录*/
		
		$(document).keydown(function(event){
        	if(event.keyCode==13){
        		/*回车键*/
        		simpleSearch();
        	} 
      	});
	</script>
</html>
